﻿@model SchoolCommunicationSystem.Models.ListTeacherUpdateViewModel

@{
    Layout = null;
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script>
    $(document).ready(function () {
        if (document.getElementById('TeacherRole').checked) {
            document.getElementById('subjectGenerated').style.display = 'block';
        }
        else {
            document.getElementById('subjectGenerated').style.display = 'none';
        }
        $("input[type=radio]").change(function () {
            if (document.getElementById('TeacherRole') != null) {
                if (document.getElementById('TeacherRole').checked) {
                    document.getElementById('subjectGenerated').style.display = 'block';
                }
                else {
                    document.getElementById('subjectGenerated').style.display = 'none';
                }
            }
        });
    });
</script>
@using (Html.BeginForm())
{  
    <fieldset>
        <legend>Giáo viên</legend>
        @Html.HiddenFor(model => model.TeacherMembershipUser.userID)
        @Html.HiddenFor(model => model.TeacherMembershipUser.password)
        @Html.HiddenFor(model => model.TeacherMembershipUser.passwordSalt)
        @Html.HiddenFor(model => model.TeacherMembershipUser.createDate)
        @Html.HiddenFor(model => model.TeacherMembershipUser.lastPasswordChangedDate)
        @Html.HiddenFor(model => model.TeacherUserID)
        @*<div class="editor-label">
            @Html.Label("Tên giáo viên:")
            @Html.LabelFor(model => model.Teachers.FirstOrDefault().teacherName)
        </div>*@
        <div class="editor-label">
            @Html.Label("Tên đăng nhập:")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TeacherMembershipUser.userName)
            @Html.ValidationMessageFor(model => model.TeacherMembershipUser.userName)
        </div>
        <div class="editor-label">
            @Html.Label("Email:")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.TeacherMembershipUser.email)
            @Html.ValidationMessageFor(model => model.TeacherMembershipUser.email)
        </div>
        <div class="editor-label">
            @Html.Label("Trạng thái:")
        </div>
        <div class="editor-field">
            @Html.RadioButtonFor(model => model.TeacherMembershipUser.isLockedOut, false) Hoạt động
            @Html.RadioButtonFor(model => model.TeacherMembershipUser.isLockedOut, true, true) Vô hiệu hóa
            @Html.ValidationMessageFor(model => model.TeacherMembershipUser.isLockedOut)
        </div>
        <div class="editor-label">
            @Html.Label("Vai trò:")
        </div>
        <div class="editor-field">
            @Html.RadioButtonFor(model => model.TeacherRole, 4) Trưởng bộ môn
            @Html.RadioButtonFor(model => model.TeacherRole, 3) Giáo viên
        </div>
        <br />
        <div class="editor-field" id="subjectGenerated">
            @if (Model._subjectID != null)
            {
                @Html.DropDownListFor(model => model._subjectID, new SelectList(Model.SubjectSelectList, "Value", "Text", Model._subjectID))
            }
            else
            {
                @Html.DropDownListFor(model => model._subjectID, Model.SubjectSelectList)
            }
        </div>
        @Html.ValidationMessageFor(model => model.TeacherRole)
        <br />
        <div style="float: left">
            <button type="submit" id="btnUpdate" name="Command" value="Update" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">
                <span class="ui-button-text">Cập nhật</span></button>
            &nbsp; &nbsp;
        </div>
    </fieldset>
}